/**
 * 
 */
package com.module.bp.player.dat;

import com.dalonedrau.d20.Diceroller;
import com.dalonedrau.jogl.engine.GameApplet;
import com.dalonedrau.jogl.opengl.animation.AnimationSequenceObject;
import com.dalonedrau.jogl.opengl.animation.AnimationSequenceObjectFactory;
import com.dalonedrau.jogl.opengl.sprite.BasicSpriteObject;
import com.dalonedrau.jogl.opengl.sprite.SpriteBase;
import com.dalonedrau.jogl.opengl.sprite.SpriteImageObject;
import com.dalonedrau.jogl.opengl.sprite.SpriteImageObjectFactory;
import com.module.bp.player.BPCharacter;
import com.module.bp.player.BPConsts;
import com.module.bp.player.BPParty;
import com.module.bp.player.BPPlayer;

/**
 * @author Donald
 *
 */
public class Prince extends BPCharacter {
	/**
	 * {@inheritDoc}
	 */
	@Override
	public SpriteBase onSmallPortrait() throws Exception {
		SpriteImageObject img =
				SpriteImageObjectFactory.getInstance().getImageByName(
						"face_paladin");
		BasicSpriteObject sb = new BasicSpriteObject();
		sb.setImageRefId(img.getRefId());
		sb.setWidth(img.getWidth());
		sb.setHeight(img.getHeight());
		return sb;
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void onInit() {
		try {
			super.addIOFlag(BPConsts.IO_PC);
			super.addIOFlag(BPConsts.IO_PRINCE);
			super.setName("Carolus");
			super.setBaseAbilityScore(BPConsts.ABILITY_COMBAT, 8);
			super.setBaseAbilityScore(BPConsts.ABILITY_ENDURANCE, 9);
			super.setBaseAbilityScore(BPConsts.ABILITY_MAX_ENDURANCE, 9);
			super.setBaseAbilityScore(BPConsts.ABILITY_WEALTH, 2);
			super.setBaseAbilityScore(BPConsts.ABILITY_WIT_WILES, 
					Math.max(2, 
							Diceroller.getInstance().rolldX(BPConsts.DIE_ROLL)));
			initializeAnimations();
		} catch (Exception ex) {
			JOGLErrorHandler.getInstance().fatalError(ex);
		}
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void onOverworldMapWalk(final int direction, final long flags) { }
	private void initializeAnimations() {
		try {
		// initialize walk animations
		} catch (Exception ex) {
			JOGLErrorHandler.getInstance().fatalError(ex);
		}
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void onAddToParty() {
		BPParty.getInstance().addGold(BPPlayer.getInstance().getWealth(2));
	}
}
